package cn.rengy.web.framework.wxmp.qrcode;

import java.util.Map;

import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.rengy.lang.ResultEntity;
import cn.rengy.web.framework.constants.Constants;


@Controller
@RequestMapping
public class WxQrcodeController {
	@Autowired
	private WxQrcodeService wxQrcodeService;

	@Value("${wxmpAppid:null}")
	private String wxmpAppid;
	/**
	 * 拉取一批二维码
	 * @return
	 */
	@RequestMapping(value="/authenticated/wx/qrcode/pull")
	@ResponseBody
	public ResultEntity pull(@RequestBody Map<String,Object> paramMap) {
		//String appid=MapUtils.getString(paramMap, "appid");
		String appid=wxmpAppid;
		int count=MapUtils.getIntValue(paramMap, "count");
		wxQrcodeService.pull(appid,count);
		return ResultEntity.ok();
	}
	
}
